<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<script type="text/javascript">
	function checkForm(){
		var studentNumber = document.getElementById("studentNumber").value;
		var detail = document.getElementById("detail").value;
		var name = document.getElementById("name").value;
		var dorm = document.getElementById("dorm").value;
		if(dorm=="def"){
		document.getElementById("error").innerHTML="请选择寝室！";
			return false;
		}
		if(studentNumber==null||studentNumber==""){
		document.getElementById("error").innerHTML="学号不能为空！";
			return false;
		}
		if(name==null||name==""){
		document.getElementById("error").innerHTML="姓名不能为空！";
			return false;
		}
		
		
		return true;
		alert("记录成功");
	}
	
	$(document).ready(function(){
		$("ul li:eq(5)").addClass("active");
	});
</script>
<div class="data_list">
		<div class="data_list_title">
		
				添加缺勤记录
			
		</div>
		<form action="record?action=save" method="post" onsubmit="return checkForm()">
			<div class="data_form" >
			<input type="hidden" name=buildid id=buildid value=${dormid }>
					<table align="center">
						<tr>
							<td><font color="red">*</font>楼栋号：</td>
							<td align="center"><b>${buildName }</b></td>
						<td><font color="red">&nbsp;&nbsp;*</font>寝室号：</td>
							<td>
							<select id="dorm" name="dorm">
        
        
            <option selected="selected" value="def">选择寝室</option>
            
           <c:forEach  varStatus="i" var="dorm" items="${dormlist}">
					
					 <option value="${dorm.dormName}">${dorm.dormBuildId}#${dorm.dormName}</option>
				
 					
				</c:forEach>
            
            
            
        </select></td>
						</tr>
						<tr>
							<td><font color="red">*</font>学&nbsp;&nbsp;号：</td>
							<td><input type="text" id="studentNumber"  name="studentNumber"   style="margin-top:5px;height:30px;"  }/></td>
						<td><font color="red">&nbsp;&nbsp;*</font>姓&nbsp;&nbsp;名：</td>
							<td><input type="text" id="name"  name="name"   style="margin-top:5px;height:30px;"  }/></td>
						</tr>
						<tr>
							<td><font color="red">*</font>日&nbsp;&nbsp;期：</td>
							<td><input type="text" id="date"  name="date" value="${date }"  style="margin-top:5px;height:30px;" readonly="readonly" /></td>
						</tr>
						<tr>
							<td><font color="red">&nbsp;</font>备&nbsp;&nbsp;注：</td>
							<td>
							<textarea rows="5" cols="10" id="detail"  name="detail" ></textarea>
							</td>
						</tr>
					</table>
					<br/>
					<div align="center">
						<input type="submit" class="btn btn-primary" value="保存"/>&nbsp;&nbsp;&nbsp;
						&nbsp;<button class="btn btn-primary" type="button" onclick="javascript:window.location='record'">返回</button>
					</div>
					<div align="center">
						<font id="error" color="red">${error }</font>
					</div>
			</div>
		</form>
</div>